package com.example.leetdemo.finash;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Solution26 {

    public int removeDuplicates(int[] nums) {
        int p = 0;
        for(int i = 1; i < nums.length; i++) {
            if(nums[i] != nums[p]) {
                nums[p + 1] = nums[i];
                p++;
            }
        }
        return p + 1;
    }

    public static void main(String[] args) {
        BigDecimal charge = BigDecimal.valueOf(278639.1557);
        BigDecimal idealCharge = BigDecimal.valueOf(306170.2654);
        System.err.println(charge.multiply(BigDecimal.valueOf(100).divide(idealCharge, 8, RoundingMode.HALF_UP)));
        System.err.println(charge.multiply(BigDecimal.valueOf(100)).divide(idealCharge, 8, RoundingMode.HALF_UP));
    }
}
